package com.bgy.config.jwt;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.bgy.config.jwt.bean.Teanant;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import com.fasterxml.jackson.annotation.JsonIgnore;

/*/**
 * @Author donnie
 * @Description //TODO
 * @Date 2019-07-18 02:26
 **/
public class JwtUser implements UserDetails {

    private Teanant teanantBena;

    //租户id
    private String id;
    //租户唯一辨识，用于动态切换数据源以及动态路由
    private String tenant;
    //租户url，用户动态路由
    private String url;
    //用户名
    private String userName;

    private String password;
    //版本号
    private int version;


    public JwtUser(String id, String password, String userName, String tenant,
                   int version, Teanant teanantBena,String url) {
        super();
        this.id = id;
        this.tenant = tenant;
        this.password = password;
        this.url = url;
        this.version = version;
        this.teanantBena = teanantBena;
    }



    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @JsonIgnore
    @Override
    public String getPassword() {
        return password;
    }

    @JsonIgnore
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @JsonIgnore
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @JsonIgnore
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @JsonIgnore
    @Override
    public boolean isEnabled() {
        return true;
    }

    @Override
    public String getUsername() {
        return userName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTenant() {
        return tenant;
    }

    public void setTenant(String tenant) {
        this.tenant = tenant;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
    public void setPassword(String password) {
        this.password = password;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public Teanant getTeanantBena() {
        return teanantBena;
    }

    public void setTeanantBena(Teanant teanantBena) {
        this.teanantBena = teanantBena;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
